<div class="detaiTab detaiTab1 m10">
<form action="<@url value='/workflowsubmit/save_ns' />" class="action-ajax-form" method="post">
     <p class="p10 ">我的审批意见</p>
    <div class="detaiTab b_t">
     <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tbody>
           <tr>
         	  <td align="right" width="18%" class="bg fontW"><span class=" fs14"><span style="color:red;">*</span>综合费率（年化）:</span></td>
                  <td width="35%">
                  <span class="fs14">
                  <#if nodeCode=='NS_XDJL' || nodeCode=='NS_ZJL' || nodeCode=='NS_FKJL'>
                  <@select class="fontW" dataSouceType="GENALRATE" value="0.15" renderonly="true"/>
                   <input type="hidden" id="generalRate" name="generalRate"  value="${loan.generalRate}"/>
                  <#else>
                  <@select id="generalRate" onchange="onGeneralSelect()" class="fontW" 
                   dataSouceType="GENALRATE" name="generalRate" value="${loan.generalRate}"/>
                 </#if>
                   </span>
				 <span id="error" style="color:red;visibility:visible;"></span>
				 </td>
           		<td align="right" class="bg" width="18%"><span style="color:red;">*</span>贷款期限:</td>
           		<td><span class="fs14">
           	 	<@select id="loanTerm" dataSouceType="OTOLOANTERM" name="loanTerm" value="${loan.loanTerm}"/></span>
		   		</td>
				<input id="loanapplyNo" type="hidden" name="loanapplyNo" value="${loan.loanapplyNo}"/>
				<input  type="hidden" name="nodeCode" value="${nodeCode}"/>
            </tr>
            
            <tr>	
              <td align="right" class="bg"><span class=" fs14"><span style="color:red;">*</span>贷款利率（年化）:</span></td>
                <td><span class=" fs14" id="loanrate">${(loan.loanrate*100)?string("0.00")}%年</span>
                	<input type="hidden" value="${loan.loanrate}" id="loanRate" name="loanrate"/>
                </td>
               <td align="right" class="bg"><span class=" fs14"><span style="color:red;">*</span>还款方式:</span></td>
               <td><span class="fs14"><@select id="repayMentway" dataSouceType="OTOREPAYMENTWAY" name="repayMentway" value="${loan.repayMentway}"/></span></td>
			 </tr>
			 
             <tr>	
                 <td align="right" class="bg"><span class=" fs14"><span style="color:red;">*</span>管理费率（年化）:</span></td>
                 <td><span class="fs14">
                  <#if nodeCode=='NS_XDJL' || nodeCode=='NS_ZJL' || nodeCode=='NS_FKJL'>
                  <@select dataSouceType="O2OMANAGEFEERATE"  value="${loan.managefeerate}" 
                  onchange="onMangerSelect()" renderonly="true"/>
                   <input type="hidden" name="managefeerate" id="manger" value="${loan.managefeerate}"/>
                  <#else>
                 <@select id="manger" dataSouceType="O2OMANAGEFEERATE" name="managefeerate" 
                 value="${loan.managefeerate}" onchange="onMangerSelect()"/>
                 </#if>
                 </span>
                 <span id="mangerError" style="color:red;visibility:visible;"></span>
				 </td>
                  <td align="right" class="bg"><span class=" fs14"><span style="color:red;">*</span>保证金费率（年化）:</span></td>
                  <td><span class="fs14">
                  <#if nodeCode=='NS_XDJL' || nodeCode=='NS_ZJL' || nodeCode=='NS_FKJL'>
                      <@select  dataSouceType="O2ODEPOSITFEERATE" value="${loan.depositrate}" renderonly="true"/>
                   <input type="hidden" id="desposit" name="depositrate" value="${loan.depositrate}"/>
                  <#else>
                   <@select id="desposit" dataSouceType="O2ODEPOSITFEERATE" name="depositrate" 
                 value="${loan.depositrate}"/>
                 </#if>
                 </span>
					</td>
              </tr>
              
              <tr>	
                <td align="right" class="bg"><span class=" fs14"><span style="color:red;">*</span>风险补偿金（年化）:</span></td>
                 <td>
                 <span class="fs14" id="expandRisk"></span>
                 <input type="hidden" name="risk" value="${expand.risk}" id="risk"/>
				 </td>
				  <td align="right" class="bg" width="15%"><span style="color:red;">*</span>EA批复额度:</td>  
				  <td>
				  	 <input id="eaMount" type="text" name="eaMount" class="tabInp inputNum action-valid-field" value="${loan.eaMount}"/>
				  </td>
              </tr>
              
              <tr>	
                <td align="right" class="bg"><span class=" fs14"><span style="color:red;">*</span>贷款用途:</span></td>
                 <td>
                 <span class="fs14"><@select id="paymentType" dataSouceType="PAYMENTTYPE" name="paymentType" 
                 value="${loan.paymentType}"/></span>
				 </td>
				  <td align="right" class="bg" width="15%"><span style="color:red;">*</span>送审银行:</td>  
				  <td>
				 <#if (loan.bankLoanName)??>
				   <span class="fs14"><@select dataSouceType="BANKTYPEO2O_SB" name="bankLoanName"
							onchange="onBankSelect()" id="bankLoanName"
							value="${loan.bankLoanName}"/></span>
							<span id="bankError" style="color:red;visibility:visible;"></span>
				 	<#else>
				 	  <span class="fs14"><@select dataSouceType="BANKTYPEO2O_SB" name="bankLoanName"
							onchange="onBankSelect()" id="bankLoanName"
							value="${loan.bankType}"/></span>
							<span id="bankError" style="color:red;visibility:visible;"></span>
				 </#if>
				  </td>
              </tr>
              <#if nodeCode=='NS_XDJL'>
               <tr>	
                <td align="right" class="bg" title="如果该笔贷款由合资公司提供担保，则选择相对应的经办平台作为回购担保方，如果该笔贷款合资公司不提供担保，则选择O2O金融中心作为回购担保方"><span style="color:red;">*</span>回购担保方<span class=" wenhaoIco">:</span></td>
                 <td colspan="3">
                 <span class="fs14"><@autocomplete url="/loanrest/findUnits?name="
									name="buybackName" onclick="_onchange_hidden_input('buybackId');"
									value="${loan.buybackName}" hideIdName="buybackId"
									hideIdValue="${loan.buybackId}"/>(联想)</span>
				 </td>
              </tr>
              </#if>
              <tr>
					<td class="bg" align="right">备注:</td>
					<td colspan="3">
					<textarea rows="3" cols="100" name="remark"></textarea>
					</td>
			  </tr>
              <tr>
					<td class="bg" align="right">操作:</td>
					<td colspan="3">
					<input type="submit" value="保存" class="btn_auto_30 btn_blue" /><span class="red fs14 ml10">(请确认本次贷款经营模式是否正确)(如需修改利率，请在利率变更理由栏目详述理由并保存，且需提前报备总部)</span></td>
			  </tr>
			  <tr>
				<td class="bg" align="right"></td>
					<td>
						<a href="<@url value='/payment/upload?referId=${loan.loanapplyNo}'/>" target="_blank">补充附件</a>
					</td>
				</tr>
         	   <tr>
				<td class="bg" align="right">保证金:</td><td colspan="3">保证金=EA批复额度*费率</td>
				</tr>
				<tr>
				<td class="bg" align="right">管理费:</td><td colspan="3">管理费=(EA批复额度*年化费率*贷款月数)/12,贷款月数(少于6个月,按6个月收取,大于6个月,按实际收取)</td>
				</tr>
				<tr>
				<td class="bg" align="right">风险补偿金:</td><td colspan="3">风险补偿金=(EA批复额度*年化费率**贷款月数)/12，贷款月数(少于6个月,按6个月收取,大于6个月,按12个月收取)</td>
				</tr>
          </tbody>
       </table>  
   </div>
   </form>
   <#if nodeCode=='NS_XDJL'>
   <div class="detaiTab detaiTab1 m10">
 	<p class="p10">
 		上传调查文档
 	</p>
    <div class="detaiTab">
        <table id="myTable" width="100%" cellspacing="0" cellpadding="0" border="0" class="b_t_e5 zjfile">
              <tbody>
                <tr>
                    <td width="15%" align="right" class="bg"> </td>
                    <td><@fileUpload url="/loanrest/othfile/DCWD/${loan.loanapplyNo}" title="上传调查文件"/></td>
                </tr>
              </tbody>
            </table> 
   </div> 
	</div>
	<#else>
   </#if>
   <div class="detaiTab detaiTab1 m10">
        <p class="p10">附件信息</p>
       <div class="dataBable"><@pagination paginationInfo="pageResult"/></div>
  </div>
       </div>
       <@js>
       $(document).ready(function(){
      		var generalRate=$("#generalRate").val();
      		if(generalRate){
      		$("#error").html("");
      	 	$("#error").css('visibility','visible'); 
      		}else{
      		$("#generalRate").val(0.15);
      		onGeneralSelect();
      		}
    	   var risk=$("#risk").val()*100+"%";
      	   $("#expandRisk").html(risk);
      	 });
      	 //综合费率
      	 function onGeneralSelect(){
      		var generalRate=$("#generalRate").val();
      		if(generalRate){
      		$("#error").html("");
      	 	$("#error").css('visibility','hidden'); 
      		}else{
      			$("#error").html("请选择综合费率");
      	 		$("#error").css('visibility','visible'); 
      	 		return;
      		}
      	 	var manger=$("#manger").val()*1;
      	 	var loanRate=$("#loanRate").val()*1;
      	 	var exisk=generalRate*1-manger-loanRate;
      	 	if(exisk<0){
      	 		$("#error").html("补偿金小于0,请修改管理费或综合费率");
      	 		$("#error").css('visibility','visible'); 
      	 	}else{
      	 		$("#error").html("");
      	 		$("#error").css('visibility','hidden'); 
      	 		$("#mangerError").html("");
      	 		$("#mangerError").css('visibility','hidden'); 
      	 		$("#bankError").html("");
      	 		$("#bankError").css('visibility','hidden'); 
      	 	}
      	 	$("#expandRisk").html((exisk*100).toFixed(2)+"%");
      	 	$("#risk").val(exisk.toFixed(4));
      	 }
      	 //管理费
      	 function onMangerSelect(){
      	 	var manger=$("#manger").val();
      	 	if(manger){
      	 	$("#mangerError").html("");
      	 	$("#mangerError").css('visibility','hidden'); 
      	 	}else{
      	 	$("#mangerError").html("请选择管理费");
      	 	$("#mangerError").css('visibility','visible'); 
      	 	return;
      	 	}
      	 	var loanRate=$("#loanRate").val()*1;
      	 	var exisk=$("#generalRate").val()*1-manger*1-loanRate;
      	 	if(exisk<0){
      	 		$("#mangerError").html("补偿金小于0,请修改管理费或综合费率");
      	 		$("#mangerError").css('visibility','visible'); 
      	 	}else{
      	 		$("#error").html("");
      	 		$("#error").css('visibility','hidden'); 
      	 		$("#mangerError").html("");
      	 		$("#mangerError").css('visibility','hidden'); 
      	 		$("#bankError").html("");
      	 		$("#bankError").css('visibility','hidden');
      	 	}
      	 	$("#expandRisk").html((exisk*100).toFixed(2)+"%");
      	 	$("#risk").val(exisk.toFixed(4));
      	 }
      	 //送审银行
      	 function onBankSelect(){
      	 	var bankLoanName=$("#bankLoanName").val();
      	 	var rate=0;
      	 	if(bankLoanName){
      	 	$("#bankError").html("");
      	 	$("#bankError").css('visibility','hidden'); 
      	 	if(bankLoanName=="CBC"){
      	 		rate=0.0775;
      	 	}else if(bankLoanName=="BC"){
      	 		rate=0.075;
      	 	}else if(bankLoanName=="GACZ"){
      	 		rate=0.07;
      	 	}else if(bankLoanName=="CCBHN"){
      	 		rate=0.07;
      	 	}else{
      	 		rate=0.08;
      	 	}
      	 	$("#loanrate").html((rate*100).toFixed(2)+"%");
      	 	var loanRate=$("#loanRate").val(rate.toFixed(4));
      	 	var manger=$("#manger").val()*1;
      	 	var exisk=$("#generalRate").val()*1-manger-rate.toFixed(4)*1;
      	 	if(exisk<0){
      	 		$("#bankError").html("补偿金小于0,请修改管理费或综合费率");
      	 		$("#bankError").css('visibility','visible'); 
      	 	}else{
      	 		$("#error").html("");
      	 		$("#error").css('visibility','hidden'); 
      	 		$("#mangerError").html("");
      	 		$("#mangerError").css('visibility','hidden'); 
      	 		$("#bankError").html("");
      	 		$("#bankError").css('visibility','hidden');
      	 	}
      	 	$("#expandRisk").html((exisk*100).toFixed(2)+"%");
      	 	$("#risk").val(exisk.toFixed(3));
      	 	}else{
      	 	$("#bankError").html("请选择送审银行");
      	 	$("#bankError").css('visibility','visible'); 
      	 	return;
      	 	}
      	 }
       </@js>
       <@jsRender/>
	</form>
